package com.ruoyi.common.sms.hnsx;

import java.util.HashMap;
import java.util.Map;

public class HnsxSend {
    private static String url = "http://47.101.151.132:18002/send.do";

    private static String uid = "9367";

    private static  String pw = "553342";

//	public static void main(String[] args) {
//		String mb = "17600000001";
//		String message = "【测试】测试";
//		SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss");
//		String tm = fmt.format(new Date());
//		send(mb, message, tm);
//	}

    /**
     * 发送短信
     *
     * @param mb
     *            手机号
     * @param message
     *            短信内容
     * @param tm
     *            当前时间
     */
    public static String send(String mb, String message, String tm) {
        if ("".equals(mb) || "".equals(message) || "".equals(tm)) {
            return null;
        }

        String passwd =HnsxUtil.getMD5(pw + tm);
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put("pw", passwd);
        map.put("mb", mb);
        map.put("ms", message);
        map.put("tm", tm);
        String result =HnsxUtil. doPost(url, map);
        System.out.println(result);
        return result;
    }
}
